using System;

using Common.Logging;

namespace JieBooLaw.Persistence.Mapper
{
    using JieBooLaw.Persistence;

    public class DataProviderFactory : IDataProviderFactory
    {
        private static ILog _log = LogManager.GetLogger(typeof(DataProviderFactory));

        #region IDataProviderFactory Members

        public IDataContext GetDataContext()
        {
            MyBatisDataContext context = null;

            try
            {
                context = new MyBatisDataContext();
            }
            catch (Exception ex)
            {
                _log.Error(string.Format("When we try to initilize a DataContext, got some error: {0}", ex.Message));
            }

            return context;
        }

        #endregion
    }
}
